package com.by.controller;

import com.by.bean.User;
import com.by.remote.UserRemoteClient;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * description:
 * author:zcx
 * lenovo
 * 时间：2022.06.09.09.57
 */
@RestController
public class PlanController {
    @Qualifier("com.by.remote.UserRemoteClient")
    @Autowired(required = false)
    UserRemoteClient userRemoteClient;
   // @HystrixCommand(defaultFallback = "error")
    @GetMapping("/plan/query")
    public Map query(){
        Map map=new HashMap();
        map.put("planaem","生产一架飞机");
        Map user=userRemoteClient.queryUser("1");
        map.put("id",user);
//        map.put("user",user);
         userRemoteClient.login("zcx","123456");
  //      User u=new User("张三",35);
//        userRemoteClient.testGetMap(map);
//        userRemoteClient.testSpringquerymap(map);
//        userRemoteClient.testGetMap(map);
//        userRemoteClient.testPosrUser(u);
//        userRemoteClient.testSpringqueryuser(u);
        return map;
    }
    public Map error(){
        Map map=new HashMap<>();
        map.put("code",0);
        map.put("msg","服务暂时忙，请稍后访问");
        return map;
    }
}
